package com.xteam.xnetworkdisk.sys.controller;

import java.util.Arrays;
import java.util.Map;

import com.xteam.xnetworkdisk.utils.PageUtils;
import com.xteam.xnetworkdisk.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.xteam.xnetworkdisk.sys.entity.FileShareRelationEntity;
import com.xteam.xnetworkdisk.sys.service.FileShareRelationService;



/**
 * 
 *
 * @author xiaozhiyong
 * @email xiaozhiyong03@gmail.com
 * @date 2024-08-12 08:54:17
 */
@RestController
@RequestMapping("sys/filesharerelation")
public class FileShareRelationController {
    @Autowired
    private FileShareRelationService fileShareRelationService;

    /**
     * 列表
     */
    @RequestMapping("/listPage")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = fileShareRelationService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{shareId}")
    public R info(@PathVariable("shareId") Integer shareId){
		FileShareRelationEntity fileShareRelation = fileShareRelationService.getById(shareId);

        return R.ok().put("fileShareRelation", fileShareRelation);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody FileShareRelationEntity fileShareRelation){
		fileShareRelationService.save(fileShareRelation);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody FileShareRelationEntity fileShareRelation){
		fileShareRelationService.updateById(fileShareRelation);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Integer[] shareIds){
		fileShareRelationService.removeByIds(Arrays.asList(shareIds));

        return R.ok();
    }

}
